{extend name="$member_base" /}
{block name="right_main"}
<link type="text/css" rel="stylesheet" href="WEB_CSS/member_aftersale.css" />
{php}
	$customer_detail = api("System.Order.customerDetail",['order_goods_id'=>$order_goods_id]);
	$detail = $customer_detail['data']['refund_detail'];
	
	$refund_money = $customer_detail['data']['total_refund_money'];
	$order_goods_info = $customer_detail['data']['order_goods_detail'];
	$shop_info = api("System.Shop.shopOrderReturnSet");
	$shop_info = $shop_info['data'];
{/php}
<div class="nc-main-right">
	<div class="refund-top">
		<div class="refund-step">
			<div class="step-spot">
				<i class="fa fa-building fa-2x ns-text-color"></i>
				<ul>
					<li class="ns-text-color">买家申请售后</li>
				</ul>
			</div>
			<div class="step">
				<div class="step-line">
					<div class="step-line-dotted ns-border-color step-line-dotted-left"></div>
					<div class="step-line-center ns-border-color"></div>
					<div class="step-line-dotted ns-border-color step-line-dotted-right"></div>
				</div>
			</div>
			<div class="step-spot">
				<i class="fa fa-credit-card-alt fa-2x {if $detail.audit_status >= 1 || $detail.audit_status == -1 || $detail.audit_status == -2}ns-text-color{else/}ns-text-color-gray{/if}"></i>
				<ul class="ns-text-color {if $detail.audit_status >= 1 || $detail.audit_status == -1 || $detail.audit_status == -2}ns-text-color{else/}ns-text-color-gray{/if}">
					<li>商家处理售后申请</li>
				</ul>
			</div>
			<div class="step">
				<div class="step-line">
					<div class="step-line-dotted {if $detail.audit_status == 5 || $detail.audit_status == -1 || $detail.audit_status == -2}ns-border-color{else/}ns-border-color-gray-shade-20{/if} step-line-dotted-left"></div>
					<div class="step-line-center {if $detail.audit_status == 5 || $detail.audit_status == -1 || $detail.audit_status == -2}ns-border-color{else/}ns-border-color-gray-shade-20{/if}"></div>
					<div class="step-line-dotted {if $detail.audit_status == 5 || $detail.audit_status == -1 || $detail.audit_status == -2}ns-border-color{else/}ns-border-color-gray-shade-20{/if} step-line-dotted-right"></div>
				</div>
			</div>
			<div class="step-spot">
				<i class="fa fa-credit-card-alt fa-2x {if $detail.audit_status == 5 || $detail.audit_status == -1 || $detail.audit_status == -2}ns-text-color{else/}ns-text-color-gray{/if}"></i>
				<ul class="{if $detail.audit_status == 5 || $detail.audit_status == -1 || $detail.audit_status == -2}ns-text-color{else/}ns-text-color-gray{/if}">
					<li>售后完成</li>
				</ul>
			</div>
		</div>
	</div>
	<div class="clearfix"></div>
	<div class="alert alert-warning  ns-bg-color-fadeout-90 ns-text-color">
		<p>{:lang('member_operation_prompt')}：</p>
		<p>1. {:lang('member_cancel_and_agree')}<em>“{:lang('member_order_refund')}”</em>{:lang('member_content_and_submit')}。</p>
		<p>2. {:lang('member_successful_and_refund')}<em>“{:lang('member_pre_deposit')}”</em>{:lang('return_balance_account')}。</p>
	</div>
	
	<!-- 提交退款申请 -->
	{if $detail.audit_status eq 0 || empty($detail)}
	<div class="refund-box">
		<div class="panel">
			<div class="panel-heading">
				<strong>{:lang('member_apply_or_complain')}。</strong>
			</div>
			<div class="panel-body">
				<div class="form-horizontal">
					<div class="form-group">
						<label for="refund_require" class="col-sm-2">{:lang('member_treatment_mode')}</label>
						<div class="col-sm-3">
							<select class="form-control" id="refund_require">
								<option value="1">{:lang('member_refund_goods')}</option>
								{if  $order_goods_info['shipping_status'] != 0 && $order_goods_info['shipping_status'] != 3 && $order_goods_info["is_virtual"] == 0}
									<option value="2">{:lang('member_refund_goods_and_money')}</option>
								{/if}
							</select>
						</div>
					</div>
					<div class="form-group">
						<label for="refund_reason" class="col-sm-2">{:lang('member_refund_reason')}</label>
						<div class="col-sm-3">
							<select class="form-control" id="refund_reason">
								<option value="{:lang('member_buyer_and_seller_agrees')}">{:lang('member_buyer_and_seller_agrees')}</option>
								<option value="{:lang('member_wrong_and_no_want')}">{:lang('member_wrong_and_no_want')}</option>
								<option value="{:lang('member_commodity_quality_problems')}">{:lang('member_commodity_quality_problems')}</option>
								<option value="{:lang('member_goods_not_received')}">{:lang('member_goods_not_received')}</option>
								<option value="{:lang('member_other')}">{:lang('member_other')}</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label for="refund_money" class="col-sm-2">{:lang("member_refund_amount")}</label>
						{if $refund_money > 0}
						<div class="col-sm-3">
							<input type="number" class="form-control" id="refund_money" placeholder="{:lang('member_please_enter_refund_amount')}" min="0">
						</div>
						{/if}
						<div class="col-sm-3">
							<p class="form-control-static">
								{if $refund_money > 0}
									<span>最多可退<strong class="ns-text-color">{$refund_money}</strong>元 </span>
								{/if}
							</p>
						</div>
					</div>
					<div class="form-group">
						<label for="refund_reason" class="col-sm-2">备注</label>
						<div class="col-sm-5">
							<textarea id="refund_reason" class="form-control" rows="5" placeholder="最多可填写200个字" maxlength="200"></textarea>
						</div>
					</div>
				</div>
				<div class="form-group refund-form-bottom">
					<div class="col-sm-10">
						<a href="javascript:submitApply();" class="save-btn ns-bg-color">{:lang("member_submit")}</a>
						<a href="{:__URL('SHOP_MAIN/member/order')}" class="back-btn">{:lang("member_cancel_and_return")}</a>
					</div>
				</div>
			</div>
		</div>
	</div>
	{elseif $detail.audit_status eq 1}
	<!-- 已提交申请 等待审核 -->
	<div class="refund-box">
		<div class="panel">
			<div class="panel-heading">
				<strong>{:lang('member_apply_or_complain')}。</strong>
			</div>
			<div class="panel-body">
				<div class="form-horizontal">
					<div class="form-group">
						<label for="refund_require" class="col-sm-2">{:lang('member_treatment_mode')}</label>
						<div class="col-sm-3">
							{if condition="$detail['refund_way'] eq 1"}
								<p class="text">{:lang('member_refund_goods')}</p>
							{elseif condition="$detail['refund_way'] eq 2" /}
								<p class="text">{:lang('member_refund_goods_and_money')}</p>
							{/if}
						</div>
					</div>
					<div class="form-group">
						<label for="refund_require" class="col-sm-2">{:lang('member_refund_reason')}</label>
						<div class="col-sm-3">
							<p class="text">{$detail['refund_reason']}</p>
						</div>
					</div>
					<div class="form-group">
						<label for="refund_require" class="col-sm-2">{:lang('member_refund_amount')}</label>
						<div class="col-sm-3">
							<p class="text">
								<span>{$detail['refund_money']} {:lang('element')}</span>
							</p>
						</div>
					</div>
					<p class="back-list">
						<a href="{:__URL('SHOP_MAIN/member/order')}">返回列表&nbsp;&gt;&gt;</a>
					</p>
				</div>
			</div>
		</div>
	</div>
	{elseif condition="$detail.audit_status eq 2" /}
	<!-- 等待买家退货 -->
	<div class="refund-box">
		<div class="panel">
			<div class="panel-heading">
				<strong>{$detail.status_name}</strong>
			</div>
			<div class="panel-body">
				<div class="form-horizontal">
					<div class="form-group">
						<label for="refund_require" class="col-sm-2">{:lang('member_return_address')}</label>
						<div class="col-sm-6">
							<p class="text">
								{if condition="$shop_info.shop_address neq ''"}
									{$shop_info.shop_address}&nbsp;&nbsp;{$shop_info.seller_name}&nbsp;&nbsp;{$shop_info.seller_mobile}&nbsp;&nbsp;{$shop_info.seller_zipcode}
								{else /}
									{:lang('member_no_delivery_address_yet')}
								{/if}
							</p>
						</div>
					</div>
					<div class="form-group">
						<label for="refund_require" class="col-sm-2">{:lang('member_logistics_company')}</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" id="express_company" min="0">
						</div>
					</div>
					<div class="form-group">
						<label for="refund_require" class="col-sm-2">{:lang('member_waybill_number')}</label>
						<div class="col-sm-3">
							<input type="text" class="form-control" id="shipping_no" min="0">
						</div>
					</div>
				</div>
				<div class="form-group refund-form-bottom clearfix">
					<div class="col-sm-10">
						{if condition="$shop_info.shop_address neq ''"}
						<a href="javascript:expressSave();" class="save-btn ns-bg-color">{:lang("member_submit")}</a>
						{else/}
						<a href="javascript:;" class="save-btn ns-bg-color-gray disabled">{:lang("member_submit")}</a>
						{/if}
						<a href="{:__URL('SHOP_MAIN/member/order')}" class="back-btn">{:lang("member_cancel_and_return")}</a>
					</div>
				</div>
			</div>
		</div>
	</div>
	{elseif $detail.audit_status eq 3}
	<!-- 等待商家收货 -->
	<div class="refund-box">
		<div class="panel">
			<div class="panel-heading">
				<strong>{$detail.status_name}</strong>
			</div>
			<div class="panel-body">
				<h3 class="refund-status-desc">{:lang('member_waiting_for_merchant')}</h3>
				<div class="back-list">
					<a href="{:__URL('SHOP_MAIN/member/order')}">返回列表&nbsp;&gt;&gt;</a>
				</div>
			</div>
		</div>
	</div>
	{elseif $detail.audit_status eq 4}
	<!-- 卖家同意退款 -->
	<div class="refund-box">
		<div class="panel">
			<div class="panel-heading">
				<strong>{$detail.status_name}</strong>
			</div>
			<div class="panel-body">
				<h3 class="refund-status-desc">{:lang('member_successfully_applied_for_refund')}</h3>
				<div class="back-list">
					<a href="{:__URL('SHOP_MAIN/member/order')}">返回列表&nbsp;&gt;&gt;</a>
				</div>
			</div>
		</div>
	</div>
	{elseif $detail.audit_status eq 5}
	<!-- 卖家已退款 -->
	<div class="refund-box">
		<div class="panel">
			<div class="panel-heading">
				<strong>{$detail.status_name}</strong>
			</div>
			<div class="panel-body">
				<h3 class="refund-status-desc">{:lang('member_refund_successful')}（{$detail.audit_time | getTimeStampTurnTime}）</h3>
				<p class="refund-result">
					<span>{:lang('member_seller')}{:lang('refunded')}<strong class="ns-text-color">{$detail.refund_real_money}</strong>{:lang('element')}</span>
				</p>
				<div class="back-list">
					<a href="{:__URL('SHOP_MAIN/member/order')}">返回列表&nbsp;&gt;&gt;</a>
				</div>
			</div>
		</div>
	</div>
	{elseif $detail.audit_status eq -1}
	<!-- 卖家拒绝本次退款 -->
	<div class="refund-box">
		<div class="panel">
			<div class="panel-heading">
				<strong>{$detail.status_name}</strong>
			</div>
			<div class="panel-body">
				<h3 class="refund-status-desc">{:lang('member_seller_rejects')}</h3>
				<div class="back-list">
					<a href="{:__URL('SHOP_MAIN/member/order')}">返回列表&nbsp;&gt;&gt;</a>
				</div>
			</div>
		</div>
	</div>
	{elseif $detail.audit_status eq -2}
	<!-- 买家主动关闭退款 -->
	<div class="refund-box">
		<div class="panel">
			<div class="panel-heading">
				<strong>{$detail.status_name}</strong>
			</div>
			<div class="panel-body">
				<h3 class="refund-status-desc">{:lang('member_refund_closed')}</h3>
				<div class="back-list">
					<a href="{:__URL('SHOP_MAIN/member/order')}">返回列表&nbsp;&gt;&gt;</a>
				</div>
			</div>
		</div>
	</div>
	{elseif $detail.audit_status eq -3}
	<!-- 退款申请被拒绝 -->
	<div class="refund-box">
		<div class="panel">
			<div class="panel-heading">
				<strong>前次申请被拒绝，可重新提交申请</strong>
			</div>
			<div class="panel-body">
				<div class="form-horizontal">
					<div class="form-group">
						<label for="refund_require" class="col-sm-2">{:lang('member_treatment_mode')}</label>
						<div class="col-sm-3">
							<select class="form-control" id="refund_require">
								<option value="1">{:lang('member_refund_goods')}</option>
								{if  $order_goods_info['shipping_status'] != 0 && $order_goods_info['shipping_status'] != 3  && $order_goods_info["is_virtual"] == 0}
									<option value="2">{:lang('member_refund_goods_and_money')}</option>
								{/if}
							</select>
						</div>
					</div>
					<div class="form-group">
						<label for="refund_reason" class="col-sm-2">{:lang('member_refund_reason')}</label>
						<div class="col-sm-3">
							<select class="form-control" id="refund_reason">
								<option value="{:lang('member_buyer_and_seller_agrees')}">{:lang('member_buyer_and_seller_agrees')}</option>
								<option value="{:lang('member_wrong_and_no_want')}">{:lang('member_wrong_and_no_want')}</option>
								<option value="{:lang('member_commodity_quality_problems')}">{:lang('member_commodity_quality_problems')}</option>
								<option value="{:lang('member_goods_not_received')}">{:lang('member_goods_not_received')}</option>
								<option value="{:lang('member_other')}">{:lang('member_other')}</option>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label for="refund_money" class="col-sm-2">{:lang("member_refund_amount")}</label>
						{if $refund_money > 0}
						<div class="col-sm-3">
							<input type="number" class="form-control" id="refund_money" placeholder="{:lang('member_please_enter_refund_amount')}" min="0">
						</div>
						{/if}
						<div class="col-sm-3">
							<p class="form-control-static">
								{if $refund_money > 0}
									<span>最多可退<strong class="ns-text-color">{$refund_money}</strong>元 </span>
								{/if}
							</p>
						</div>
					</div>
					<div class="form-group">
						<label for="refund_reason" class="col-sm-2">备注</label>
						<div class="col-sm-5">
							<textarea id="refund_reason" class="form-control" rows="5" placeholder="最多可填写200个字" maxlength="200"></textarea>
						</div>
					</div>
				</div>
				<div class="form-group refund-form-bottom">
					<div class="col-sm-10">
						<a href="javascript:submitApply();" class="save-btn ns-bg-color">{:lang("member_submit")}</a>
						<a href="{:__URL('SHOP_MAIN/member/order')}" class="back-btn">{:lang("member_cancel_and_return")}</a>
					</div>
				</div>
			</div>
		</div>
	</div>
	{/if}
</div>
<input type="hidden" id="max_refund_money" value="{$refund_money}">
{/block}
{block name="script"}
<script>
var order_goods_id ="{$order_goods_id}";
{notempty name="$detail"}
var aftersale_id = "{$detail.id}";
{else/}
var aftersale_id = 0;
{/notempty}
</script>
<script type="text/javascript" src="WEB_JS/member_aftersale.js"></script>
{/block}